package 双指针;

import java.util.Map;

/**
 * @author tmh
 * @date 2024/11/25 20:27
 * @description
 */
public class T11盛最多水的容器 {
    public int maxArea(int[] height) {
        int right = height.length - 1;
        int maxArea=0;
        for (int left = 0; left < right; ) {
            int minHeight = height[left]>height[right]?height[right--]:height[left++];
            int area = minHeight*(right-left+1);
            maxArea= Math.max(area,maxArea);
        }
        return maxArea;
    }
}
